package com.itboye.ihomebank.adapter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.itboye.ihomebank.R;
import com.itboye.ihomebank.bean.HouseListBeanCopy;

public class ChooseAreaAdapter extends BaseAdapter {

	private Context context;
	List<HouseListBeanCopy.HouseItem> itemList;

	public ChooseAreaAdapter(Context context, List<HouseListBeanCopy.HouseItem>  item) {
		this.context = context;
		this.itemList = item;
	}

	@Override
	public int getCount() {
		if (itemList == null) {
			return 0;
		}
		return itemList.size();
	}

	@Override
	public Object getItem(int position) {
		return itemList.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {

		Datalist data = new Datalist();
		if (convertView == null) {
			convertView = LayoutInflater.from(context).inflate(
					R.layout.item_choose_area, null);
			data.mNameTextView = (TextView) convertView.findViewById(R.id.name);
			convertView.setTag(data);
		} else {
			data = (Datalist) convertView.getTag();
		}
		data.mNameTextView.setText(itemList.get(position).getName());
		// data.mImage.setVisibility(View.VISIBLE);
		return convertView;
	}

	private class Datalist {
		public TextView mNameTextView;
		public ImageView mImage;
	}

}
